package utils;

import java.util.ArrayList;
import java.util.List;

public class ListPair<T> {
	private List<T> leftList, rightList;
	
	public ListPair() {
		this.leftList = new ArrayList<T>();
		this.rightList = new ArrayList<T>();
	}
	
	public ListPair(List<T> left, List<T> right) {
		this.leftList = left;
		this.rightList = right;
	}

	/**
	 * @return the leftList
	 */
	public List<T> getLeftList() {
		return leftList;
	}

	/**
	 * @param leftList the leftList to set
	 */
	public void setLeftList(List<T> leftList) {
		this.leftList = leftList;
	}

	/**
	 * @return the rightList
	 */
	public List<T> getRightList() {
		return rightList;
	}

	/**
	 * @param rightList the rightList to set
	 */
	public void setRightList(List<T> rightList) {
		this.rightList = rightList;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((leftList == null) ? 0 : leftList.hashCode());
		result = prime * result
				+ ((rightList == null) ? 0 : rightList.hashCode());
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof ListPair)) {
			return false;
		}
		ListPair other = (ListPair) obj;
		if (leftList == null) {
			if (other.leftList != null) {
				return false;
			}
		} else if (!leftList.equals(other.leftList)) {
			return false;
		}
		if (rightList == null) {
			if (other.rightList != null) {
				return false;
			}
		} else if (!rightList.equals(other.rightList)) {
			return false;
		}
		return true;
	}

	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("Left List:").append(leftList.toString());
		sb.append("\nRightList:").append(rightList.toString());
		return sb.toString();
	}
}
